﻿using UnityEngine;

namespace M_CharactorSystem
{
	public abstract class ICharactor : MonoBehaviour
	{
		//共有属性
		public bool B_Killed; //是否阵亡
		public Animator M_Animator; //角色控制柄挂载的动画组件
        public GameObject M_Model; //人物模型
		public bool B_Attack; //是否可以攻击
		public Vector3 M_MovingVec; //移动值
		public Vector3 M_DeltaPos; //动画自身的移动量
		public float WalkSpeed = 2; //走路（散步）速度
		public float RunSpeed = 2; //奔跑速度
		
        protected ICharactorAttr CharactorAttr = null; //角色属性对象
		protected IWeapon Weapon; //武器对象（桥接模式）

		//设置角色属性
		public void SetCharactorAttr(ICharactorAttr theCharactorAttr)
		{
			CharactorAttr = theCharactorAttr;
		}

		//取得攻击力
		public int GetAtkValue()
		{
			return Weapon.GetAtkValue();
		}

		//攻击敌人
		public virtual void Attack(ICharactor theTarget){}
		//被敌人攻击
		public virtual void UnderAttack(ICharactor theTarget){}
	}
}

